namespace Brjnk.Common
{
    using System;
    using System.Windows.Data;

    /// <summary>
    /// </summary>
    public class DipToLengthConverter : IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            if (value == null) return string.Empty;
            var dpi = (double)value;
            Distance d = Brjnk.Common.UI.DIPHelper.GetCmFromDip(dpi) / 100.0;
            return d.ToStringShortLength();
        }

        public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            throw new NotImplementedException();
        }
    }
}